package edu.upol.paradise.compiler.types;

import org.apache.log4j.Logger;

import edu.upol.paradise.compiler.ParadiseCompiledBlock;

public class ClosureVariableWrapper implements ParadiseObject {
	static final Logger log = Logger.getLogger(ClosureVariableWrapper.class);
	
	private ParadiseCompiledBlock closure;
	private String                identificator;
	
	public ClosureVariableWrapper(ParadiseCompiledBlock closure,
			String identificator) {
		super();
		this.closure = closure;
		this.identificator = identificator;
	}

	public boolean isTrue() {
		return get().isTrue();
	}

	public ParadiseObject get() {
		return closure.getBlockVariableMappings().get(identificator);
	}
	
	public void set(ParadiseObject o){
		closure.getBlockVariableMappings().put(identificator, o);
	}

	public boolean isAtom() {
		return true;
	}

	public boolean valueEquals(ParadiseObject other) {
		if (other == this) return true;
		return false;
	}

	public int atomHashId() {
		return 0;
	}
}
